<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>js-属性</title>
</head>
<body>

<a href="#" id="link1">主页</a>
<img src="" alt="r" id="pic1">
<h1>大标题</h1>
<!--行内标记，一般用于包裹文字-->
<span>这是一段文字</span><span>这是一段文字2</span>
</body>
<script>


    document.getElementById('link1')
        .href = 'https://www.jianshu.com/p/86013f954a87';
   var pic1= document.getElementById('pic1');
   pic1.src='1.jpg';
   var spans=  document.getElementsByTagName('span');
   /**
    *  又没有其他方式完成类似效果
    * */
   for(var i in spans){
       spans[i].style.color = 'green';

   }


</script>
</html>